package com.to3ks.excelservice.mapper;

import com.to3ks.common.base.utils.StringUtil;
import com.to3ks.excelservice.entity.XlsSwry;


import java.util.List;

public class XlsSwryProvider {

    public String insertListSql(List<XlsSwry> list) {
        StringBuffer sqlList = new StringBuffer();

        sqlList.append(" INSERT INTO xls_swry(id,swry_dm,swryxm,sfzjhm,lxdh,JRSWJSJ,yxbz,is_deleted,gmt_create,gmt_modified)  VALUES ");

        for (int i = 0; i < list.size() ; i++) {
            XlsSwry xlsSwry = list.get(i);
            sqlList.append(" (")
                    .append(xlsSwry.getId())
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getSwryDm()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getSwryxm()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getSfzjhm()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getLxdh()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getJrswjsj()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getYxbz()))
                    .append(",")
                    .append(xlsSwry.getDeleted())
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getGmtCreate().toString()))
                    .append(",")
                    .append(StringUtil.convertToDyhString(xlsSwry.getGmtModified().toString()))
                    .append(")");
            if (i < list.size()-1) {
                sqlList.append(",");
            }
        }
        return sqlList.toString();
    }
}
